package com.moss.cloud.common.sms.factory;

import com.moss.cloud.common.sms.constant.SmsTypeEnum;
import com.moss.cloud.common.sms.operation.SmsOperation;
import com.moss.cloud.common.sms.realize.TencentSms;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

/**
 * 短信工厂
 *
 * @author 瑾年
 * @date 2023年4月19日
 */
public class SmsFactory {
    static Map<String, SmsOperation> operationMap = new HashMap<>();

    static {
        operationMap.put(SmsTypeEnum.TENCENT_CLOUD.code(), new TencentSms());
    }

    public static Optional<SmsOperation> smsType(String type) {
        return Optional.ofNullable(operationMap.get(type));
    }
}
